{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d2c52f13",
   "metadata": {},
   "outputs": [],
   "source": [
    "from selenium import webdriver\n",
    "\n",
    "browser = webdriver.Chrome()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "473f0a86",
   "metadata": {},
   "outputs": [],
   "source": [
    "browser.get(\"http://www.douban.com\")\n",
    "form = browser.find_element_by_css_selector(\"div.anony-srh form\")\n",
    "\n",
    "form.find_element_by_css_selector(\"input[type=text]\").send_keys(\"八佰\")\n",
    "form.submit()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "83ae680c",
   "metadata": {},
   "outputs": [],
   "source": [
    "form = browser.find_element_by_css_selector(\"div.mod-search > form\")\n",
    "\n",
    "q = form.find_element_by_css_selector(\"input[name=q]\")\n",
    "q.clear()\n",
    "q.send_keys(\"长津湖\")\n",
    "form.submit()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
